package testJdk.lambda.testConsumer;

import com.google.common.collect.Lists;
import org.junit.Test;

import java.util.List;

/**
 * @version 1.0.0
 * Created by cyd on 2021-12-15 11:38:23
 * @ClassName : learn_jdk.lambda.testConsumer.ConsumerTester
 * @Description : 类描述
 */
public class ConsumerTester {
    @Test
    public void testHappy() {
        ConsumerUtil.happy(50, (m) -> {
            System.out.println("花了" + m + "元");
        });
    }

    @Test
    public void testHandleList() {
        List<Integer> list = Lists.newArrayList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
        ConsumerUtil.handleList(list, l -> {
            for (Object o : l) {
                // 模拟处理业务
                System.out.println("处理业务：" + o);
            }
        });
    }
}
